﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;

namespace FiveSister.DAL
{
    /// <summary>
    /// Summary description for CartDAL
    /// </summary>
    public class UserDAL : BaseDAL
    {
        public UserDAL()
        {
            
        }
        public DataSet CheckLoginUser(string username, string password)
        {
            DataSet ds = new DataSet();
            string[] uspParaName = new string[] { "?UserName", "?Password" };
            object[] uspParaValue = new object[] { username, password };
            string uspName = "usp_user_CheckLogin";

            ds = base.RunProcedure(uspParaName, uspParaValue, uspName);
            return ds;
        }
        public DataSet SelectAll()
        {
            DataSet ds = new DataSet();
            string[] uspParaName = new string[] { };
            object[] uspParaValue = new object[] { };
            string uspName = "usp_user_getAll";

            ds = base.RunProcedure(uspParaName, uspParaValue, uspName);
            return ds;
        }
        public DataSet SelectUser(string userName, int userId)
        {
            DataSet ds = new DataSet();
            string[] uspParaName = null;
            object[] uspParaValue = null;
            string uspName = "";
            if (userName.Length > 0 && userId == null)
            { 
                
            }
            if (userName.Length == 0 && userId > 0)
            {
                uspParaName = new string[] { "?userid", "?username" };
                uspParaValue = new object[] { userId, userName };
                uspName = "usp_user_getuser";
            }
            if (userName.Length > 0 && userId > 0)
            {

            }
            ds = base.RunProcedure(uspParaName, uspParaValue, uspName);
            return ds;
        }
    }
}